package com.xu.commons.dao.mpl;

import javax.sql.DataSource;




import com.xu.commons.dao.DataSourceFactory;


/**
 * 抽象数据源工厂
 * @author xupeijiao
 *
 * @param <T>
 */

public abstract class AbstractDataSourceFactory<T extends DataSource> implements DataSourceFactory  {
	
	protected final String driver = "";
    protected final String url = "";
    protected final String username = "";
    protected final String password ="";
    
    @Override
    public final T getDataSource(){
    	//创建数据源
    	T ds  = createDataSource();
    	setDriver(ds,driver);
    	setUrl(ds,url);
    	setPassword(ds,password);
    	setUserName(ds,username);
    	return ds;
    }
    public  abstract T createDataSource();
    
    public abstract void setDriver(T ds, String driver);
    
    public abstract void setUrl(T ds,String url);
    
    public abstract void setPassword(T ds,String password);
    
    public abstract void  setUserName(T ds,String username);
}
